<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>宽高左顶</title>
	<style type="text/css">
	*{padding:0px;margin:0px; list-style:none; text-decoration: none;}
	#one {width:150px;height:40px;background: #eee;
		position:absolute; left:100px; top:50px;  
		}
	</style>
</head>
<body>
	<div id='one'></div>
	<script type="text/javascript">
	//获取元素
	var one =document.getElementById('one');

	//获取当前元素的宽
	 var res= one.offsetWidth;
	 //获取当前元素的高
	 var res =one.offsetHeight;

	 //获取当前元素距离父级的左偏移量
	 var res=one.offsetLeft;

	 //获取当前元素距离父级的顶部偏移量
	// var res = one.offsetTop;
	 console.log(res);

	</script>
</body>
</html>